/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mongoosehome.web.util;

/**
 * 对字符串进行处理
 *
 * @author Administrator
 */
public class StringUtils {

    private static String fromEncode = "ISO8859-1";
    private static String toEncode = "UTF-8";
    private static boolean encodeToCN = true;
    /**
     * 
     * @param str
     * @return 
     */
    public static boolean isFine(String str) {
        if (str == null || str.trim().length() == 0) {
            return false;
        }
        return true;
    }
    
    /**
     * 将指定的字符串转换成toEncode的编码
     * @param isoString
     * @return
     */
    public static String encodingToCN(String isoString) {
        if (null == isoString || isoString.length() < 1)
            return "";
        try {
            if(encodeToCN){
                String returnString = new String(isoString.getBytes(fromEncode), toEncode);
                return returnString;
            }else{
                return isoString;
            }
        } catch (Exception e) {
            return "";
        }
    }
}
